package com.easymin.weixin.entity.zhuanche;

import org.springframework.util.CollectionUtils;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 起步开始时段.
 *
 * @author Shine
 */
public class ChargeStartTime {
  
  private static final long serialVersionUID = 1L;

  private Long id;

  private Date created;

  private Date updated;

  private Integer startHour;// 开始时间 时

  private Integer startMinute;// 开始时间 分

  private Integer endHour;// 结束时间 时

  private Integer endMinute;// 结束时间 分

  private BigDecimal cost; // 单价（起步价）

  private Double qblc;// 起步里程(最后超过xx公里)

  private List<ChargeStartDistance> chargeStartDistances;

  private Integer mfdhsj;// 免费等候时间(分钟);

  private BigDecimal dhsjAtonceCost; // 超过mfdhsj，立马收费dhsjAtonceCost元

  private Integer dhsjUnit;// 等候时间单位(分钟);

  private Integer dhsjThresholdt;// 等候时间阀值(分钟);

  private BigDecimal dhsjCost; // 等候时间收费

  private Double djglUnit;// 代驾公里单位(公里);

  private Double djglThresholdt;// 代驾公里阀值(公里);

  private BigDecimal djglCost; // 代驾公里收费

  private Long areaId;

  /* 时间收费 */
  private Integer qbsj;// 开始代驾起步时间(分钟)

  private Integer djsjUnit;// 代驾时间单位(分钟);

  private Integer djsjThresholdt;// 代驾时间阀值(分钟);

  private BigDecimal djsjCost; // 代驾时间收费

  /* 时间收费 */

  public Integer getStartHour() {
    return startHour;
  }

  public void setStartHour(Integer startHour) {
    this.startHour = startHour;
  }

  public Integer getStartMinute() {
    return startMinute;
  }

  public void setStartMinute(Integer startMinute) {
    this.startMinute = startMinute;
  }

  public Integer getEndHour() {
    return endHour;
  }

  public void setEndHour(Integer endHour) {
    this.endHour = endHour;
  }

  public Integer getEndMinute() {
    return endMinute;
  }

  public void setEndMinute(Integer endMinute) {
    this.endMinute = endMinute;
  }

  public BigDecimal getCost() {
    if (null == cost) {
      return new BigDecimal(0);
    }
    return cost;
  }

  public void setCost(BigDecimal cost) {
    this.cost = cost;
  }

  public Double getQblc() {
    if (null == qblc) {
      return 0d;
    }
    return qblc;
  }

  public void setQblc(Double qblc) {
    this.qblc = qblc;
  }

  public Integer getMfdhsj() {
    if (null == mfdhsj) {
      return 0;
    }
    return mfdhsj;
  }

  public void setMfdhsj(Integer mfdhsj) {
    this.mfdhsj = mfdhsj;
  }

  public Integer getDhsjUnit() {
    if (null == dhsjUnit) {
      return 0;
    }
    return dhsjUnit;
  }

  public void setDhsjUnit(Integer dhsjUnit) {
    this.dhsjUnit = dhsjUnit;
  }

  public Integer getDhsjThresholdt() {
    if (null == dhsjThresholdt) {
      return 0;
    }
    return dhsjThresholdt;
  }

  public void setDhsjThresholdt(Integer dhsjThresholdt) {
    this.dhsjThresholdt = dhsjThresholdt;
  }

  public BigDecimal getDhsjCost() {
    if (null == dhsjCost) {
      return new BigDecimal(0);
    }
    return dhsjCost;
  }

  public void setDhsjCost(BigDecimal dhsjCost) {
    this.dhsjCost = dhsjCost;
  }

  public Double getDjglUnit() {
    if (null == djglUnit) {
      return 0d;
    }
    return djglUnit;
  }

  public void setDjglUnit(Double djglUnit) {
    this.djglUnit = djglUnit;
  }

  public Double getDjglThresholdt() {
    if (null == djglThresholdt) {
      return 0d;
    }
    return djglThresholdt;
  }

  public void setDjglThresholdt(Double djglThresholdt) {
    this.djglThresholdt = djglThresholdt;
  }

  public BigDecimal getDjglCost() {
    if (null == djglCost) {
      return new BigDecimal(0);
    }
    return djglCost;
  }

  public void setDjglCost(BigDecimal djglCost) {
    this.djglCost = djglCost;
  }

  public Long getAreaId() {
    return areaId;
  }

  public void setAreaId(Long areaId) {
    this.areaId = areaId;
  }

  public Integer getQbsj() {
    if (null == qbsj) {
      return 0;
    }
    return qbsj;
  }

  public void setQbsj(Integer qbsj) {
    this.qbsj = qbsj;
  }

  public BigDecimal getDhsjAtonceCost() {
    if (null == dhsjAtonceCost) {
      return new BigDecimal(0);
    }
    return dhsjAtonceCost;
  }

  public void setDhsjAtonceCost(BigDecimal dhsjAtonceCost) {
    this.dhsjAtonceCost = dhsjAtonceCost;
  }

  public Integer getDjsjUnit() {
    if (null == djsjUnit) {
      return 0;
    }
    return djsjUnit;
  }

  public void setDjsjUnit(Integer djsjUnit) {
    this.djsjUnit = djsjUnit;
  }

  public Integer getDjsjThresholdt() {
    if (null == djsjThresholdt) {
      return 0;
    }
    return djsjThresholdt;
  }

  public void setDjsjThresholdt(Integer djsjThresholdt) {
    this.djsjThresholdt = djsjThresholdt;
  }

  public BigDecimal getDjsjCost() {
    if (null == djsjCost) {
      return new BigDecimal(0);
    }
    return djsjCost;
  }

  public void setDjsjCost(BigDecimal djsjCost) {
    this.djsjCost = djsjCost;
  }

  public List<ChargeStartDistance> getChargeStartDistances() {
    if (!CollectionUtils.isEmpty(chargeStartDistances)) {
      for (int i = 0; i < chargeStartDistances.size(); i++) {
        if (i == 0) {
          chargeStartDistances.get(i).setStartdistance(0d);
        } else {
          chargeStartDistances.get(i).setStartdistance(
              chargeStartDistances.get(i - 1).getDistance());
        }
      }
    }
    return chargeStartDistances;
  }

  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public Date getCreated() {
    return created;
  }

  public void setCreated(Date created) {
    this.created = created;
  }

  public Date getUpdated() {
    return updated;
  }

  public void setUpdated(Date updated) {
    this.updated = updated;
  }

  public void setChargeStartDistances(List<ChargeStartDistance> chargeStartDistances) {
    this.chargeStartDistances = chargeStartDistances;
  }

  public boolean isEmpty() {
    if (null != startHour && null != startMinute && null != endHour && null != endMinute
        && null != cost) {
      return false;
    }
    return true;
  }

}
